home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Science⁄Math
/
Gnuplot 3.5 for Macintosh
/
SOURCES 3.5
/
term
/
bigfig.trm
< prev
next >
Wrap
Text File
|
1993-11-03
|
4KB
|
124 lines
/*
* $Id: bigfig.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
*/
/* GNUPLOT - fig.trm */
/*
* Copyright (C) 1990, 1991, 1992
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* Permission to modify the software is granted, but not the right to
* distribute the modified code. Modifications are to be distributed
* as patches to released version.
*
* This software is provided "as is" without express or implied warranty.
*
* This file is included by ../term.c.
*
* This terminal driver supports:
* Fig graphics language
*
* AUTHORS
* Micah Beck, David Kotz
*
* send your comments or suggestions to (info-gnuplot@dartmouth.edu).
*
*/
/*
* Original for Fig code output by Micah Beck, 1989
* Department of Computer Science, Cornell University
* Updated by David Kotz for gnuplot 2.0
* More efficient output by Ian Dall
* Increased size of plot by Ian Dall
* Updated to FIG 2.1 (with color) by Vivek Khera
*/
#define BFIG_HTIC (7*FIG_RES/80)
#define BFIG_VTIC (7*FIG_RES/80)
#define BFIG_FONT_S (16) /* size in points */
#define BFIG_VCHAR (BFIG_FONT_S*72/FIG_RES) /* height in pixels of font */
#define BFIG_HCHAR (BFIG_VCHAR*6/10) /* this is a guess at the width */
#define BFIG_ARROW_WIDTH (BFIG_HTIC/2 + 1)
#define BFIG_ARROW_HEIGHT BFIG_HTIC
/* 8 inches wide by 5 inches high */
#define BFIG_XMAX (8 * FIG_RES)
#define BFIG_YMAX (5 * FIG_RES)
#define BFIG_XOFF (FIG_RES/2)
#define BFIG_YOFF (FIG_RES/2)
BFIG_vector(ux,uy)
unsigned int ux,uy;
{
int x=ux, y=uy;
if (FIG_polyvec_stat != FIG_poly_part)
{
fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f %d %d %d\n",
O_POLYLINE, T_POLYLINE,
FIG_type, 1, FIG_color, 0, FIG_DEFAULT, 0, FIG_spacing, 0,0,0);
fprintf(outfile, "%d %d",
BFIG_XOFF + FIG_posx, BFIG_YMAX + BFIG_YOFF - FIG_posy);
FIG_poly_vec_cnt = 1;
FIG_polyvec_stat = FIG_poly_part;
}
fprintf(outfile, " %d %d",
BFIG_XOFF + x, BFIG_YMAX + BFIG_YOFF-y);
FIG_poly_vec_cnt++;
if (FIG_poly_vec_cnt > 50)
FIG_poly_clean(FIG_polyvec_stat);
FIG_posx = x;
FIG_posy = y;
}
BFIG_arrow(sx, sy, ex, ey, head)
int sx, sy; /* start coord */
int ex, ey; /* end coord */
TBOOLEAN head;
{
FIG_poly_clean(FIG_polyvec_stat);
fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f %d %d %d\n",
O_POLYLINE, T_POLYLINE,
FIG_type, 1, FIG_color, 0, FIG_DEFAULT, 0, FIG_spacing,
0, head ? 1 : 0, 0);
/* arrow line */
if ( head )
fprintf(outfile, "%d %d %.3f %.3f %.3f\n",
0, 0, 1.0,
(double)BFIG_ARROW_WIDTH, (double)BFIG_ARROW_HEIGHT);
fprintf(outfile, "%d %d %d %d 9999 9999\n",
BFIG_XOFF + sx, BFIG_YOFF + BFIG_YMAX - sy,
BFIG_XOFF + ex, BFIG_YOFF + BFIG_YMAX - ey);
FIG_posx = ex;
FIG_posy = ey;
}
BFIG_put_text(x, y, str)
int x, y;
char *str;
{
if (strlen(str) == 0) return;
FIG_poly_clean(FIG_polyvec_stat);
y -= FIG_VCHAR/2; /* assuming vertical center justified */
fprintf(outfile, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d %s\01\n",
O_TEXT, FIG_justify,
FIG_ROMAN_FONT, BFIG_FONT_S, FIG_DEFAULT, FIG_DEFAULT, 0,
FIG_angle, SPECIAL_TEXT, BFIG_VCHAR, BFIG_HCHAR*strlen(str),
BFIG_XOFF + x, BFIG_YMAX + BFIG_YOFF-y, str);
}